<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>遍历find()</title>
    <script src="../jquery-3.4.1.js"></script>
    <style>
        .left {
            width: auto;
            height: 200px;
        }
        .left div {
            width: 150px;
            height: 70px;
            padding: 5px;
            margin: 5px;
            float: left;
            background: #bbffaa;
            border: 1px solid #ccc;
        }
        span {
            color: blue;
        }
    </style>
</head>
<body>
    <h2>find方法()</h2>
    <div class="left first-div">
        <div class="div">
            <ul class="level-1">
                <li class="item-1">1</li>
                <li class="item-2">2</li>
                <li class="item-3">3</li>
            </ul>
        </div>
        <div class="div">
            <ul class="level-2">
                <li class="item-1">1</li>
                <li class="item-2 test">2</li>
                <li class="item-3">3</li>
            </ul>
        </div>
        <div class="div">
            <ul class="level-3">
                <li class="item-1">1</li>
                <li class="item-2">2</li>
                <li class="item-3">3</li>
            </ul>
        </div>
    </div>
    <button>find传递表达式</button>
    <br/>
    <br/>
    <h3>find表达式</h3>
    <div style="border:1px solid red;">
        <p>
            <span>测试1</span>
            <a>测试2</a>
        </p>
        <p>
            <span>慕课网1</span>
            <a>慕课网2</a>
        </p>
        <div>
            <span>Aaron1</span>
            <a>Aaron2</a>
        </div>
    </div>
    <br/>
    <br/>
    <button>find传递jquery对象</button>
</body>
<script>
   $("button:first").click(function () {
       $(".left").find('li:last').css('border','1px solid red')
   });

   $("button:last").click(function () {
        var $spans = $('span');
        $("p").find($spans).css('color',"green")
   });
</script>
</html>